﻿<!DOCTYPE html>
<html lang="en">
<#include "../include/resource-head.ftl"/>
<body>
<#assign active='expressList'/>
<#include "../include/common-top.ftl"/>
<div class="main-container" id="main-container">
    <div class="main-container-inner">
    <#include "../include/common-menu.ftl"/>
        <div class="main-content">
            <div class="page-content">
                <div class="row">
                    <div class="col-xs-12">
                        <div class="form-search">
                            <form role="form" class="form-inline clearfix" id="form" action="">
                                <div class="input-group col-xs-3">
                                    <span class="input-group-addon">编号</span>
                                    <input type="text" class="form-control" name="no" value="${no!}">
                                </div>
                                <div class="input-group col-xs-3">
                                    <span class="input-group-addon">状态</span>
                                    <select  class="form-control" name="status">
                                        <option value="">全部</option>
                                        <option value="1" <#if status! == '1'>selected</#if>>待出库</option>
                                        <option value="2" <#if status! == '2'>selected</#if>>运输中</option>
                                        <option value="3" <#if status! == '3'>selected</#if>>已签收</option>
                                        <option value="4" <#if status! == '4'>selected</#if>>退回待审核</option>
                                        <option value="5" <#if status! == '5'>selected</#if>>退回审核通过</option>
                                        <option value="6" <#if status! == '6'>selected</#if>>退回审核未通过</option>
                                    </select>
                                </div>
                            </form>
                            <div class="form-tool btn-group">
                                <button class="btn btn-sm btn-success" form="form">
                                    <i class="icon-search"></i>搜索
                                </button>
                            </div>
                        </div>
                        <div class="table-responsive">
                            <table id="sample-table-1" class="table table-striped table-bordered table-hover">
                                <thead>
                                <tr>
                                    <th>编号</th>
                                    <th>发货人</th>
                                    <th>收货人</th>
                                    <th>收货地址</th>
                                    <th>运输方式</th>
                                    <th>类型</th>
                                    <th>付款方式</th>
                                    <th>添加时间</th>
                                    <th>状态</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <#list pageInfo.list as item>
                                <tr>
                                    <td>${item.no}</td>
                                    <td>${item.senduser!}</td>
                                    <td>${item.receiveuser!}</td>
                                    <td>${item.province!}-${item.city!}-${item.area!}</td>
                                    <td>
                                        <#if 1 == item.trantype!>
                                            <span class="label label-sm label-success">空运</span>
                                        <#else>
                                            <span class="label label-sm label-warning">陆运</span>
                                        </#if>
                                    </td>
                                    <td>
                                        <#if item.type == 'small'>
                                            <span class="label label-sm label-info">小件</span>
                                        <#elseif item.type == 'middle'>
                                            <span class="label label-sm label-warning">中等件</span>
                                        <#else >
                                            <span class="label label-sm label-pink">大件</span>
                                        </#if>
                                    </td>
                                    <td>
                                        <#if 1 == item.paytype!>
                                            <span class="label label-sm label-success">到付</span>
                                        <#else>
                                            <span class="label label-sm label-primary">已付</span>
                                        </#if>
                                    </td>
                                    <td>${item.addtime?string('yyyy-MM-dd HH:mm:ss')}</td>
                                    <td>
                                        <#if item.status == 0>
                                            <span class="label label-sm label-info">取消</span>
                                        <#elseif item.status == 1>
                                            <span class="label label-sm label-warning">待出库</span>
                                        <#elseif item.status == 2>
                                            <span class="label label-sm label-primary">运送中</span>
                                        <#elseif item.status == 3>
                                            <span class="label label-sm label-success">已签收</span>
                                        <#elseif item.status == 4>
                                            <span class="label label-sm label-warning">退回待审核</span>
                                        <#elseif item.status == 5>
                                            <span class="label label-sm label-pink">审核通过</span>
                                        <#elseif item.status == 6>
                                            <span class="label label-sm label-yellow">审核没通过</span>
                                        </#if>
                                    </td>
                                    <td>
                                        <div class="visible-md visible-lg hidden-sm hidden-xs btn-group">
                                            <#if item.status == 1>
                                                <a class="btn btn-xs btn-primary" href="#"
                                                   onclick="chuku('${item.id}')">出库</a>

                                            </#if>
                                            <#if item.status gt 1 && item.status lte 4>
                                                <a class="btn btn-xs btn-success" href="/logistics/detail/${item.id}">
                                                    物流信息
                                                </a>
                                            </#if>
                                            <#if item.status == 4>
                                                <a class="btn btn-xs btn-warning" href="javascript:if(confirm('确定审核通过吗？')){location.href='/express/verify?id=${item.id}&status=5';}">审核通过</a>
                                                <a class="btn btn-xs btn-danger" href="javascript:if(confirm('确定审核不通过吗？')){location.href='/express/verify?id=${item.id}&status=6';}">审核不通过</a>
                                            </#if>
                                            <a class="btn btn-xs btn-info" href="/express/detail/${item.id}">
                                                <i class="icon-edit bigger-120"></i>
                                            </a>
                                        </div>
                                    </td>
                                </tr>
                                </#list>
                                </tbody>
                            </table>
                        <#include "../include/table-page.ftl"/>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="modal fade" id="user" tabindex="-1" role="dialog">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="modalAcceptLabel">选择快递员</h4>
                </div>
                <form class="form-horizontal" name="form" id="form" method="post" action="/express/chuku">
                    <div class="modal-body" id="m-msg">

                        <input type="hidden" name="expressId" id="expressId">
                        <div class="form-group has-info">
                            <label class="col-xs-12 col-sm-3 control-label no-padding-right">快递员</label>
                            <div class="col-xs-12 col-sm-5">
                                <select class="width-100" name="userId">
                                <#if userList??>
                                    <#list userList as item>
                                        <option value="${item.id}">${item.name}</option>
                                    </#list>
                                </#if>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                        <button type="submit" class="btn btn-primary">提交</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</body>
<#include "../include/resource-script.ftl"/>
<script>
    function chuku(id) {
        $("#expressId").val(id);
    <#if userList?? && userList?size gt 0>
        $("#user").modal("show");
    <#else>
        tipMsg("没有可用的快递员");
    </#if>
    }
</script>

</html>

